﻿<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="RestServiceWebClient._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <%--<script type="text/jscript" src="Scripts/jquery-1.4.1.min.js" />--%>
    <script type="text/javascript">

            function GetProducts() {
            alert('test');
//            $.ajax({
//                type: "GET",
//                url: "http://localhost:8892/BilgeRestService.svc/GetProducts",
//                data: "{}",
//                contentType: "application/json; charset=utf-8",
//                dataType: "json",
//                success: OnSuccessJson,
//                error: OnErrorJson
//            });
        }
        function OnSuccessJson(data, status) {
            var result = data;
            var div1 = document.getElementById('div1');
            for (var i = 0; i < data.length; i++) {
                div1.innerHTML = data[i].ProductName + " - " + data[i].CategoryName + "</br>";
            }
        }
        function OnErrorJson(data, status) {
            alert("Exception");
        } 
    </script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        Welcome to ASP.NET!
    </h2>
    <p>
        To learn more about ASP.NET visit <a href="http://www.asp.net" title="ASP.NET Website">
            www.asp.net</a>.
    </p>
    <p>
        You can also find <a href="http://go.microsoft.com/fwlink/?LinkID=152368&amp;clcid=0x409"
            title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN</a>.
    </p>
    <input id="btnGetProducts" type="button" value="Get Products" onclick="GetProducts()" />
    <div id="div1">
    </div>
</asp:Content>
